import React from 'react'
import * as routerTypes from '@/constants/routerType'

const Home = React.lazy((_) => import('@/pages/blog/home'))
const Archives = React.lazy((_) => import('@/pages/blog/archives'))
const Friends = React.lazy((_) => import('@/pages/blog/friends'))
const Walls = React.lazy((_) => import('@/pages/blog/walls'))
const Profile = React.lazy((_) => import('@/pages/blog/profile'))
const Detail = React.lazy((_) => import('@/pages/blog/detail'))
const Category = React.lazy((_) => import('@/pages/blog/category'))
const Login = React.lazy((_) => import('@/pages/blog/login'))

// import Home from "@/pages/blog/home";
// import Archives from "@/pages/blog/archives";
// import Friends from "@/pages/blog/friends";
// import Walls from "@/pages/blog/walls";
// import Profile from "@/pages/blog/profile";
// import Detail from "@/pages/blog/detail";
// import Category from "@/pages/blog/category";
// import Login from "@/pages/blog/login";

/**
 * 路由切换
 * @param type {string}
 * @param userId
 * @param localId
 * @returns {*}
 */
export default function switchRouter(type, userId, localId) {
  switch (type) {
    case routerTypes.HOME:
      return <Home userId={userId} localId={localId} />
    case routerTypes.ARCHIVES:
      return <Archives userId={userId} localId={localId} />
    case routerTypes.FRIENDS:
      return <Friends userId={userId} localId={localId} />
    case routerTypes.WALLS:
      return <Walls userId={userId} localId={localId} />
    case routerTypes.PROFILE:
      return <Profile userId={userId} localId={localId} />
    case routerTypes.DETAIL:
      return <Detail userId={userId} localId={localId} />
    case routerTypes.CATEGORY:
      return <Category userId={userId} localId={localId} />
    default:
      return <Login />
  }
}
